<template>
  <el-table :data="tableData" style="width: 80%; left: 10%">
    <el-table-column prop="job" label="职位" width="180"> </el-table-column>
    <el-table-column prop="cname" label="公司" width="180"> </el-table-column>
    <el-table-column prop="py" label="评语"> </el-table-column>
    <!-- <el-table-column prop="score" label="打分">
      <template slot-scope="scope">
        <el-rate v-model="scope.row.score" @change="changeScore(scope.row.id,scope.row.score)"></el-rate>
      </template>
    </el-table-column> -->
    <el-table-column prop="state" label="状态" width="100">
      <template slot-scope="scope">
        <span v-if="scope.row.state === 3">通过初筛</span>
        <span v-if="scope.row.state === 6">通过一面</span>
        <span v-if="scope.row.state === 8">通过二面</span>
        <span v-if="scope.row.state === 9">不适合</span>
        <span v-if="scope.row.state === 10">拟录用</span>
      </template>
    </el-table-column>
  </el-table>
</template>

<script>
  export default {
    data() {
      return {
        tableData: [
          {
            job: "2016-05-02",
            cname: "王小虎",
            py: "上海市普陀区金沙江路 1518 弄",
            score: null,
          },
          {
            job: "2016-05-04",
            cname: "王小虎",
            py: "上海市普陀区金沙江路 1517 弄",
            score: null,
          },
          {
            job: "2016-05-01",
            name: "王小虎",
            py: "上海市普陀区金沙江路 1519 弄",
            score: null,
          },
          {
            job: "2016-05-03",
            cname: "王小虎",
            py: "上海市普陀区金沙江路 1516 弄",
            score: null,
          },
        ],
      };
    },
    methods: {
      // stateFormat:function(row){
      //   if(row === 3){
      //     return "通过初筛";
      //   }
      // },
      changeScore: function (id,score) {
        console.log("what is this")
        var url = this.$store.state.ip + "/userRe/updateScore";
        // 参数
        let param = new URLSearchParams();
        param.append("id", id);
        param.append("score", score);
        console.log(id,score)
        this.$axios({
          method: "post",
          url: url,
          data: param,
        }).then((res) => {
          console.log(res.data);
        });
      }
    },
    created() {
      var id = this.$store.state.userId;
      console.log("获取userId:", id);
      var url = this.$store.state.ip + "/userRe/userReUM";
      // 参数
      let param = new URLSearchParams();
      param.append("uid", id);
      // param.append("state", 6);
      this.$axios({
        method: "post",
        url: url,
        data: param,
      }).then((res) => {
        console.log(res.data);
        this.tableData = res.data;
      });
    },
  };
</script>